package com.seventh.associationsystem.repository;

import com.seventh.associationsystem.bean.Association;
import com.seventh.associationsystem.bean.AssociationStatus;
import com.seventh.associationsystem.bean.AssociationType;
import com.seventh.associationsystem.bean.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

public interface AssociationRepository extends JpaRepository<Association, String>, JpaSpecificationExecutor<Association> {
    Page<Association> findByTypeAndStatus(AssociationType type, AssociationStatus associationStatus, Pageable pageable);

    Page<Association> findByStatus(AssociationStatus associationStatus, Pageable pageable);

    List<Association> findByStatus(AssociationStatus associationStatus);

    Page<Association> findByMembersContainingAndStatus(User user, AssociationStatus associationStatus, Pageable pageable);

    Association findByName(String name);

    Association findByUid(String uid);
}
